/*
 * @Descripttion: 用户信息集合
 * @version: 
 * @Author: wtzhang
 * @Date: 2021-05-31 13:51:02
 * @LastEditors: wtzhang
 * @LastEditTime: 2021-06-02 13:15:36
 */
const mongoose = require('mongoose')
const db = require('./db')
const Schema = mongoose.Schema

// 用户列表数据表结构
let userSchema = new Schema({
  email: {
    type: String,
    required: true
  },
  nickname: {
    type: String,
    required: true
  },
  password: {
    type: String,
    required: true
  },
  create_time: {
    type: Date,
    default: Date.now
  },
  last_modified: {
    type: Date,
    default: Date.now
  },
  avatar: {
    type: String,
    default: '/public/img/avatar-default.png'
  },
  bio: {
    type: String,
    default: ''
  },
  gender: {
    type: Number,
    enum: [-1, 0, 1],
    default: -1
  },
  birthday: {
    type: String,
    default: ''
  },
  status: {
    type: Number,
    // 0 没有权限限制
    // 1 不可以评论
    // 2 不可以登录
    enum: [0, 1, 2],
    default: 0
  }
})

module.exports = mongoose.model('User', userSchema)